package csel.controller.commands;

import csel.model.*;
import csel.view.*;

public class EquipCommand implements GameCommand
{
	private EquippableItem[] items;
	private Entity entity;

	//creates an instance of the Equip command
	public EquipCommand(Model model, StatusViewport statusViewport)
	{
		this.entity = model.getPlayerEntity();
		this.items = statusViewport.getSelectedEquipmentItems();
	}

	// Iterates over the items and equips them
	public void execute()
	{
		if (items != null)
		{
			for (EquippableItem i : items)
			{
				entity.setEquippedItem(i);
			}
		}
		System.out.println("[MODEL] the Equip command has been called");
	}

}